<?php 

require_once('getconfig.php');

Class Model_district extends Dbo_DbManager
 {

	protected $c_district;
	protected $n_distcount;
	protected $n_buy_listed;
	protected $n_rent_listed;

 	public function __construct($bolCon=TRUE) {
		parent::__construct($bolCon);
	}
	
	public function getDistrict()
	{
		return  $this->c_district;
	}
	public function getDistcount()
	{
		return  $this->n_distcount;
	}
	public function getBuylisted()
	{
		return  $this->n_buy_listed;
	}
	public function getRentlisted()
	{
		return  $this->n_rent_listed;
	}		
	
//value seting
	public function setDistrict($c_district)
	{
		$this->c_district=$c_district;
	}
	public function setDistcount($n_distcount)
	{
		$this->n_distcount=$n_distcount;
	}
	public function setBuylisted($n_buy_listed)
	{
		$this->n_buy_listed=$n_buy_listed;
	}
	public function setRentlisted($n_rent_listed)
	{
		$this->n_rent_listed=$n_rent_listed;
	}			

	

	public function write()
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->write($this,FALSE);
	}
	public static function delete($intproductid)
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->remove($intproductid,__CLASS__);
	}

	public static function build(array $arrModel_district)
	{
		$objModel_district = new Model_district(FALSE);
		@$objModel_district->setDistrict($arrModel_district['c_district']);
		@$objModel_district->setDistcount($arrModel_district['n_distcount']);
	//	@$objModel_district->setBuylisted($arrModel_district['n_buy_listed']);
	//	@$objModel_district->setRentlisted($arrModel_district['n_rent_listed']);
		
		return $objModel_district;
 	 } 	
	 
	public static function builddistandcount(array $arrModel_district)
	{
		$objModel_district = new Model_district(FALSE);
		@$objModel_district->setDistrict($arrModel_district['c_district']);
		@$objModel_district->setBuylisted($arrModel_district['n_buy_listed']);
		
		return $objModel_district;
 	 }	  
    
     public static function get_districtListed(){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select * from district order by c_district ";
		//echo $qry;
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
	
     public static function get_Listeddistrictvalue(){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select * from listeddistrict order by c_district ";
		//echo $qry;
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}	
     public static function get_Districtandcount(){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select c_district,n_buy_listed from listeddistrict order by c_district ";
		//echo $qry;
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::builddistandcount ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}		
	


 }
 ?>